package com.lv.hechuang.utils;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;

import com.lv.hechuang.app.App;


/**
 * 全局工具类
 */
public class ApplicationUtils {

    // 全局上下文环境获取
    public static Context getAppContext() {
        return App.instance().getApplicationContext();
    }

    /**
     * 获取本程序包信息
     *
     * @return
     */
    public static PackageInfo getPackageInfo() {
        try {
            PackageInfo pinfo = getAppContext().getPackageManager()
                    .getPackageInfo(getAppContext().getPackageName(), 0);
            return pinfo;
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }


}
